//
//  ZJStudySpecialDetailHeaderView.m
//  LovingPartyBuilding
//
//  Created by ZJ on 2017/5/2.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJStudySpecialDetailHeaderView.h"
#import "CustomLabel.h"
@interface ZJStudySpecialDetailHeaderView ()
{
    UILabel *_course;/**< 课程设计 */
}
/** title */
@property (nonatomic, strong) CustomLabel *titleLabel;
@end

@implementation ZJStudySpecialDetailHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor viewBGGrayColor];
        //专题简介
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12 * [UIScreen zj_screenWScale], 0, self.width - 24 * [UIScreen zj_screenWScale], 34 * [UIScreen zj_screenHScale])];
        label.font = [UIFont titleTextFont];
        label.textColor = [UIColor textBlackColor];
        label.text = @"专题简介";
        
        [self addSubview:label];
        self.titleLabel.frame = CGRectMake(0, label.bottom, self.width, 10);
        [self addSubview:self.titleLabel];
        //专题简介
       _course = [[UILabel alloc] initWithFrame:CGRectMake(12 * [UIScreen zj_screenWScale], self.titleLabel.bottom, self.width - 24 * [UIScreen zj_screenWScale], 34 * [UIScreen zj_screenHScale])];
        _course.font = [UIFont titleTextFont];
        _course.textColor = [UIColor textBlackColor];
        _course.text = @"课程设计";
        [self addSubview:_course];
    }
    return self;
}

#pragma mark - Setter
- (void)setTitle:(NSString *)title{
    _title = title;
    self.titleLabel.height = [NSString sizeOfString:title font:[UIFont titleTextFontSize] width:self.width - 24 * [UIScreen zj_screenWScale]].height + 24 * [UIScreen zj_screenHScale];
    self.titleLabel.text = title;

    _course.y = self.titleLabel.bottom;
    self.height = _course.bottom;
}

#pragma mark - Getters

- (CustomLabel *)titleLabel{
    if (_titleLabel == nil){
        _titleLabel = [CustomLabel new];
        _titleLabel.textColor = [UIColor textBlackColor];
        _titleLabel.backgroundColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont titleTextFont];
        _titleLabel.textInsets = UIEdgeInsetsMake(12 * [UIScreen zj_screenHScale], 12 * [UIScreen zj_screenWScale], 0, 12 * [UIScreen zj_screenWScale]);
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}


@end
